<?php
namespace App\Http\Query;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;

class PschangeQuery extends Model
{

    // 设置表名
    const TABLE_NAME = "pschange_master";

    protected $pschange_master = 'pschange_master';

    protected $primaryKey = 'pschange_id';

    protected $PschangeMaster = self::TABLE_NAME;

    public $timestamps = false;

    public function updPschangeMaster($login_id, $newpassword) // 改
    {
        $sql = 'update user_master set password = ? ,updated_at = now() where login_id=?';
        $param = [
            $newpassword,
            $login_id
        ];
        DB::update($sql, $param);
        return;
    }

    public function getUserInfoByLoginId($loginId)
    {
        $sql = 'select user_id, login_id, password, corp_id, auth, user_name from user_master where login_id = ? and delete_flg = 0';
        $param = [
            $loginId
        ];
        $users = DB::select($sql, $param);
        return $users;
    }
}
